﻿<?xml version="1.0" encoding="utf-8"?>
<xs:schema id="DataSetAVGCounters" targetNamespace="http://tempuri.org/DataSetAVGCounters.xsd" xmlns:mstns="http://tempuri.org/DataSetAVGCounters.xsd" xmlns="http://tempuri.org/DataSetAVGCounters.xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:msprop="urn:schemas-microsoft-com:xml-msprop" attributeFormDefault="qualified" elementFormDefault="qualified">
  <xs:annotation>
    <xs:appinfo source="urn:schemas-microsoft-com:xml-msdatasource">
      <DataSource DefaultConnectionIndex="0" FunctionsComponentName="QueriesTableAdapter" Modifier="AutoLayout, AnsiClass, Class, Public" SchemaSerializationMode="IncludeSchema" xmlns="urn:schemas-microsoft-com:xml-msdatasource">
        <Connections>
          <Connection AppSettingsObjectName="Settings" AppSettingsPropertyName="SQLServerOptimizerConnectionString" ConnectionStringObject="" IsAppSettingsProperty="true" Modifier="Assembly" Name="SQLServerOptimizerConnectionString (Settings)" ParameterPrefix="@" PropertyReference="ApplicationSettings.SQLServerOptimizer.PL.WPF.Properties.Settings.GlobalReference.Default.SQLServerOptimizerConnectionString" Provider="System.Data.SqlClient" />
        </Connections>
        <Tables>
          <TableAdapter BaseClass="System.ComponentModel.Component" DataAccessorModifier="AutoLayout, AnsiClass, Class, Public" DataAccessorName="AVGCountersAdapter" GeneratorDataComponentClassName="AVGCountersAdapter" Name="AVGCounters" UserDataComponentName="AVGCountersAdapter">
            <MainSource>
              <DbSource ConnectionRef="SQLServerOptimizerConnectionString (Settings)" DbObjectName="SQLServerOptimizer.Performance.Trace" DbObjectType="Table" FillMethodModifier="Public" FillMethodName="Fill" GenerateMethods="Both" GenerateShortCommands="false" GeneratorGetMethodName="GetData" GeneratorSourceName="Fill" GetMethodModifier="Public" GetMethodName="GetData" QueryType="Rowset" ScalarCallRetval="System.Object, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" UseOptimisticConcurrency="false" UserGetMethodName="GetData" UserSourceName="Fill">
                <SelectCommand>
                  <DbCommand CommandType="Text" ModifiedByUser="true">
                    <CommandText>SELECT        Performance.Trace.TraceID, AVG(Performance.CpuUsage.Percentage) AS CpuUsage, AVG(Performance.DiskIO.AvgDiskSecPerRead) AS avgdr, 
                         AVG(Performance.DiskIO.AvgDiskSecPerWrite) AS avgdw, AVG(Performance.DiskIO.DiskReadsPerSec) AS DiskReads, AVG(Performance.DiskIO.DiskWritesPerSec) 
                         AS DiskWrites, AVG(Performance.DiskIO.CurrentDiskQueueLength) AS QueueLength, AVG(Performance.InstanceData.pageLifeExpectancy) AS PLE, 
                         AVG(Performance.InstanceData.connections) AS Connections
FROM            Performance.[Disk] INNER JOIN
                         Performance.PerfServer ON Performance.[Disk].PerfServerID = Performance.PerfServer.PerfServerID INNER JOIN
                         Performance.DiskIO ON Performance.[Disk].DiskID = Performance.DiskIO.DiskID INNER JOIN
                         Performance.Trace INNER JOIN
                         Performance.Time ON Performance.Trace.TraceID = Performance.Time.TraceID ON Performance.DiskIO.TimeID = Performance.Time.TimeID INNER JOIN
                         Performance.Instance ON Performance.PerfServer.PerfServerID = Performance.Instance.PerfServerID INNER JOIN
                         Performance.InstanceData ON Performance.Time.TimeID = Performance.InstanceData.TimeID AND 
                         Performance.Instance.InstanceID = Performance.InstanceData.InstanceID INNER JOIN
                         Performance.CpuCore ON Performance.PerfServer.PerfServerID = Performance.CpuCore.PerfServerID INNER JOIN
                         Performance.CpuUsage ON Performance.Time.TimeID = Performance.CpuUsage.TimeID AND 
                         Performance.CpuCore.CpuCoreID = Performance.CpuUsage.CoreID
WHERE        (@ServerID = Performance.PerfServer.PerfServerID) AND (@TraceID = Performance.Trace.TraceID)
GROUP BY Performance.Trace.TraceID</CommandText>
                    <Parameters>
                      <Parameter AllowDbNull="false" AutogeneratedName="ServerID" ColumnName="" DataSourceName="" DataTypeServer="unknown" DbType="Int32" Direction="Input" ParameterName="@ServerID" Precision="0" ProviderType="Int" Scale="0" Size="1024" SourceColumn="" SourceColumnNullMapping="false" SourceVersion="Current" />
                      <Parameter AllowDbNull="false" AutogeneratedName="TraceID" ColumnName="" DataSourceName="" DataTypeServer="unknown" DbType="Int32" Direction="Input" ParameterName="@TraceID" Precision="0" ProviderType="Int" Scale="0" Size="1024" SourceColumn="" SourceColumnNullMapping="false" SourceVersion="Current" />
                    </Parameters>
                  </DbCommand>
                </SelectCommand>
              </DbSource>
            </MainSource>
            <Mappings>
              <Mapping SourceColumn="TraceID" DataSetColumn="TraceID" />
              <Mapping SourceColumn="avgdr" DataSetColumn="avgdr" />
              <Mapping SourceColumn="avgdw" DataSetColumn="avgdw" />
              <Mapping SourceColumn="PLE" DataSetColumn="PLE" />
              <Mapping SourceColumn="Connections" DataSetColumn="Connections" />
              <Mapping SourceColumn="CpuUsage" DataSetColumn="CpuUsage" />
              <Mapping SourceColumn="DiskReads" DataSetColumn="DiskReads" />
              <Mapping SourceColumn="DiskWrites" DataSetColumn="DiskWrites" />
              <Mapping SourceColumn="QueueLength" DataSetColumn="QueueLength" />
            </Mappings>
            <Sources />
          </TableAdapter>
        </Tables>
        <Sources />
      </DataSource>
    </xs:appinfo>
  </xs:annotation>
  <xs:element name="DataSetAVGCounters" msdata:IsDataSet="true" msdata:UseCurrentLocale="true" msprop:EnableTableAdapterManager="true" msprop:Generator_DataSetName="DataSetAVGCounters" msprop:Generator_UserDSName="DataSetAVGCounters">
    <xs:complexType>
      <xs:choice minOccurs="0" maxOccurs="unbounded">
        <xs:element name="AVGCounters" msprop:Generator_TableClassName="AVGCountersDataTable" msprop:Generator_TableVarName="tableAVGCounters" msprop:Generator_TablePropName="AVGCounters" msprop:Generator_RowDeletingName="AVGCountersRowDeleting" msprop:Generator_RowChangingName="AVGCountersRowChanging" msprop:Generator_RowEvHandlerName="AVGCountersRowChangeEventHandler" msprop:Generator_RowDeletedName="AVGCountersRowDeleted" msprop:Generator_UserTableName="AVGCounters" msprop:Generator_RowChangedName="AVGCountersRowChanged" msprop:Generator_RowEvArgName="AVGCountersRowChangeEvent" msprop:Generator_RowClassName="AVGCountersRow">
          <xs:complexType>
            <xs:sequence>
              <xs:element name="TraceID" msdata:ReadOnly="true" msdata:AutoIncrement="true" msdata:AutoIncrementSeed="-1" msdata:AutoIncrementStep="-1" msprop:Generator_ColumnVarNameInTable="columnTraceID" msprop:Generator_ColumnPropNameInRow="TraceID" msprop:Generator_ColumnPropNameInTable="TraceIDColumn" msprop:Generator_UserColumnName="TraceID" type="xs:int" />
              <xs:element name="avgdr" msdata:ReadOnly="true" msprop:Generator_ColumnVarNameInTable="columnavgdr" msprop:Generator_ColumnPropNameInRow="avgdr" msprop:Generator_ColumnPropNameInTable="avgdrColumn" msprop:Generator_UserColumnName="avgdr" type="xs:int" minOccurs="0" />
              <xs:element name="avgdw" msdata:ReadOnly="true" msprop:Generator_ColumnVarNameInTable="columnavgdw" msprop:Generator_ColumnPropNameInRow="avgdw" msprop:Generator_ColumnPropNameInTable="avgdwColumn" msprop:Generator_UserColumnName="avgdw" type="xs:int" minOccurs="0" />
              <xs:element name="PLE" msdata:ReadOnly="true" msprop:Generator_ColumnVarNameInTable="columnPLE" msprop:Generator_ColumnPropNameInRow="PLE" msprop:Generator_ColumnPropNameInTable="PLEColumn" msprop:Generator_UserColumnName="PLE" type="xs:int" minOccurs="0" />
              <xs:element name="Connections" msdata:ReadOnly="true" msprop:Generator_ColumnVarNameInTable="columnConnections" msprop:Generator_ColumnPropNameInRow="Connections" msprop:Generator_ColumnPropNameInTable="ConnectionsColumn" msprop:Generator_UserColumnName="Connections" type="xs:int" minOccurs="0" />
              <xs:element name="CpuUsage" msdata:ReadOnly="true" msprop:Generator_ColumnVarNameInTable="columnCpuUsage" msprop:Generator_ColumnPropNameInRow="CpuUsage" msprop:Generator_ColumnPropNameInTable="CpuUsageColumn" msprop:Generator_UserColumnName="CpuUsage" type="xs:int" minOccurs="0" />
              <xs:element name="DiskReads" msdata:ReadOnly="true" msprop:Generator_ColumnVarNameInTable="columnDiskReads" msprop:Generator_ColumnPropNameInRow="DiskReads" msprop:Generator_ColumnPropNameInTable="DiskReadsColumn" msprop:Generator_UserColumnName="DiskReads" type="xs:int" minOccurs="0" />
              <xs:element name="DiskWrites" msdata:ReadOnly="true" msprop:Generator_ColumnVarNameInTable="columnDiskWrites" msprop:Generator_ColumnPropNameInRow="DiskWrites" msprop:Generator_ColumnPropNameInTable="DiskWritesColumn" msprop:Generator_UserColumnName="DiskWrites" type="xs:int" minOccurs="0" />
              <xs:element name="QueueLength" msdata:ReadOnly="true" msprop:Generator_ColumnVarNameInTable="columnQueueLength" msprop:Generator_ColumnPropNameInRow="QueueLength" msprop:Generator_ColumnPropNameInTable="QueueLengthColumn" msprop:Generator_UserColumnName="QueueLength" type="xs:int" minOccurs="0" />
            </xs:sequence>
          </xs:complexType>
        </xs:element>
      </xs:choice>
    </xs:complexType>
    <xs:unique name="Constraint1" msdata:PrimaryKey="true">
      <xs:selector xpath=".//mstns:AVGCounters" />
      <xs:field xpath="mstns:TraceID" />
    </xs:unique>
  </xs:element>
</xs:schema>